{extend name="public/base"/}
{block name="body"}

<div class="main-box clearfix">
	<header class="main-box-header clearfix">
		<div class="pull-left">
			<h2>配置管理</h2>
		</div>
		<div class="pull-right">
			<a href="{:url('Config/index')}" class="btn btn-primary">
				<i class="fa fa-list"></i> 
				配置列表
			</a>
			<a href="{:url('Config/add')}" class="btn btn-danger">
				<i class="fa fa-list"></i> 
				添加配置
			</a>
		</div>
	</header>
	<div class="main-box-body clearfix">
		<div class="tabs-wrapper">
			<ul class="nav nav-tabs">
				{volist name=":config('config_group_list')" id="item"}
				<li {if condition="$key eq $id"}class="active"{/if}>
					<a href="{:url('Config/group',array('id'=>$key))}">{$item}</a>
				</li>
				{/volist}
			</ul>
			<div class="tab-content">
				<div class="tab-pane fade in active" id="tab-home">
					<form method="post" class="form form-horizontal" role="form">
						{volist name="list" id="item"}
						<div class="form-group">
							<label for="inputEmail1" class="col-lg-2 control-label">{$item['title']}</label>
							<div class="col-lg-10">
								{switch name="item['type']"}
								{case value="text"}
								<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:50%;">
								{/case}
								{case value="num"}
								<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:30%;">
								{/case}
								{case value="string"}
								<input type="text" class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" value="{$item['value']}" placeholder="{$item['title']}" style="width:80%;">
								{/case}
								{case value="textarea"}
								<textarea class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:80%; height:120px;">{$item['value']}</textarea>
								{/case}
								{case value="select"}
								<select class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:auto;">
									{volist name=":parse_config_attr($item['extra'])" id="vo"}
									<option value="{$key}" {eq name="item['value']" value="$key"}selected{/eq}>{$vo}</option>
									{/volist}
								</select>
								{/case}
								{case value="bool"}
								<select class="form-control" name="config[{$item['name']}]" id="config[{$item['name']}]" style="width:auto;">
									{volist name=":parse_config_attr($item['extra'])" id="vo"}
									<option value="{$key}" {eq name="item['value']" value="$key"}selected{/eq}>{$vo}</option>
									{/volist}
								</select>
								{/case}
								{/switch}
								{if condition="$item['remark']"}
								<span class="help-block">（{$item['remark']}）</span>
								{/if}
							</div>
						</div>
						{/volist}
						<div class="form-group">
							<div class="col-lg-offset-2 col-lg-10">
								<button type="submit" class="btn btn-success submit-btn ajax-post" target-form="form">确认提交</button>
								<button class="btn btn-danger btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>

{/block}